using System;
using System.Reflection;

namespace ValidationFramework.Tests
{
    public static class ReflectionUtilities
    {
		public static object CallMethod<TMethodOwner>(object target, string method, params object[] values)
        {
            var types = new Type[values.Length];
            for (var i = 0; i < values.Length; i++)
            {
                types[i] = values[i].GetType();
            }

            var type = typeof(TMethodOwner);
            var info = type.GetMethod(method, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, types, null);
            return info.Invoke(target, values);
        }


    }
}